package ai.people.netmon.framework.exception.enums;

/**
 * 系统异常枚举
 *
 * @author yuanqinglong
 * @date 2022/2/15 17:07
 */
public enum SystemExceptionEnum implements ExceptionEnum {
    INVALID_PARAMETER_DATA(false, 500000, "无效的数据："),

    PARENT_MENU_DOES_NOT_EXIST(false, 510000, "父级菜单不存在！"),
    DUPLICATE_MENU_NAME(false, 510001, "菜单名称重复！"),
    MENU_DOES_NOT_EXIST(false, 510002, "菜单不存在！"),
    MENU_PERMISSION_DELETION_FAILED(false, 510003, "菜单权限删除失败！"),
    INVALID_MENU_ID(false, 510004, "无效的菜单ID："),

    PARENT_ROLE_DOES_NOT_EXIST(false, 520000, "父级角色不存在！"),
    DUPLICATE_ROLE_NAME(false, 520001, "角色名称重复！"),
    ROLE_DOES_NOT_EXIST(false, 520002, "角色不存在！"),
    ROLE_MENU_DOES_NOT_EXIST(false, 520003, "角色菜单不存在！"),
    CHARACTER_MENU_DELETION_FAILED(false, 520004, "角色菜单删除失败！"),
    ROLE_IN_USE(false, 520005, "角色已分配用户、不可删除！"),

    ACCOUNT_ALREADY_EXISTS(false, 530000, "账号名称已存在！"),
    NO_ROLE_ASSIGNED(false, 530001, "账号未分配角色！"),
    ACCOUNT_DOES_NOT_EXIST(false, 530002, "账号不存在！"),

    USER_ROLE_ALREADY_EXISTS(false, 540001, "用户角色已存在！"),
    USER_ROLE_UPDATE_FAILED(false, 540002, "用户角色更新失败！"),
    USER_CANNOT_BE_DELETED_WITHOUT_A_ROLE_ASSIGNED(false, 540003, "用户未分配角色，无法删除！");


    /**
     * 状态
     */
    final boolean status;
    /**
     * 代码
     */
    final int code;
    /**
     * 消息
     */
    final String message;

    SystemExceptionEnum(boolean status, int code, String message) {
        this.status = status;
        this.code = code;
        this.message = message;
    }


    @Override
    public Integer getCode() {
        return this.code;
    }

    @Override
    public String getMessage() {
        return this.message;
    }

    @Override
    public boolean getStatus() {
        return this.status;
    }
}
